/*
 * main.c
 *
 *  Created on: 27.01.2012
 *      Author: Christoph
 */

#ifdef __USE_CMSIS
#include "LPC11Uxx.h"
#endif

#include <cr_section_macros.h>
#include <NXP/crp.h>

/// Variable to store CRP value in.
/// Will be placed automatically by the linker when "Enable Code Read Protect" selected.<br>
/// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

#include <stdio.h>

#include "gpio.h"
#include "application.h"
#include "mcu_regs.h"
#include "type.h"
#include "typedefs.h"
#include "timer16.h"
#include "timer32.h"
#include "ssp.h"
#include "DOGSdisplay.h"
#include "ecg.h"
#include "num_conversion.h"

///////////////////////////////////////////////////////////////////////////////
/// @brief		the main program.
///////////////////////////////////////////////////////////////////////////////
int main(void)
{
    uint8_t i;

	GPIOInit();

    initDogs();
	init_timer32(1, 10);


//	while(1)
//	{
		delay32Ms(1, 500);
		lcd_string(0,0,"Hello World ...", ptr_font_6x8, DELETE); //Printing a line in a small font
		delay32Ms(1, 2500);
//		lcd_clear_all();
//	}
	lcd_clear_all();
	for(i= 0; i < 90; i++)
	{
		uint8_t help = (ecg[i] + ecg[i+1] + ecg[i+2])/20;
		lcd_plot(i/3, 32 - (help));
		delay32Ms(1, 50);
		//i++;
		i++;
	}

	lcd_rect(0, 0, 127, 31);
	lcd_rect(10, 5, 30, 18);
	lcd_string(20,15,"Hello World ...", ptr_font_6x8, DELETE);
	while(1);
	return(0);
}
